
import 'package:baselib/util/common_utils.dart';
import 'package:baselib/util/const_config.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/controller/SplashControl.dart';
import 'package:flutter_app/util/colours.dart';
// import 'package:flutter_html/flutter_html.dart';
// import 'package:flutter_html/image_render.dart';
import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart';
import 'package:get/get.dart';

class WebViewPage extends StatefulWidget {


  WebViewPage();

  @override
  State<StatefulWidget> createState() {
    return new WebViewPageState();
  }
}

class WebViewPageState extends State<WebViewPage> {


  bool isShowKnow = true;
  final SpalshController control = SpalshController.to;



  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    control.getXieyi(context);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: new AppBar(
          brightness: Brightness.light,
          backgroundColor: Colors.white,
          leading: new IconButton(
              icon: Image.asset(
                CommonUtils.getImgPath("icon_back_black.png"),
                width: 19,
                height: 32,
              ),
              onPressed: () {
                Get.back();
              }),
          title: new Text("易车车用户协议",
              style: TextStyle(
                  fontSize: 20,
                  color: Colors.black,
                  decoration: TextDecoration.none)),
          centerTitle: true),
      body: Container(
          child: SingleChildScrollView(
            child:Obx(()=>HtmlWidget(control.htmlData.value))
          ),
      ),
      bottomNavigationBar:BottomAppBar(
        child: Visibility(
          visible: isShowKnow,
          child: Container(
            height: 60,
            alignment: Alignment.center,
            child: RaisedButton(
              child: Text("我已知晓",
                  style: new TextStyle(
                      color: Colors.white, fontSize: 18)),
              shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.all(
                      Radius.circular(4))),
              color: ColourRes.app_blue,
              onPressed: () {
                control.isKnown.value=true;
                Get.back();
              },
            ),
          ),
        )
      ) ,
    );
  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
  }
}
